package io.ouka.jvm.hotspot.selfread.domain;

import java.util.Arrays;

/**
 * @author ouka
 * LocalVariableTable
 */
public class LocalVariableTable extends AttributeInfo{

    private int tableLength;
    private Item[] table;

    @Override
    public String toString() {
        return "LocalVariableTable{" +
                "tableLength=" + tableLength +
                ", table=" + Arrays.toString(table) +
                '}';
    }

    public int getTableLength() {
        return tableLength;
    }

    public void setTableLength(int tableLength) {
        this.tableLength = tableLength;
        this.table = new Item[tableLength];
    }

    public Item[] getTable() {
        return table;
    }

    public void setTable(Item[] table) {
        this.table = table;
    }

    public class Item {
        private int startPc;
        private int length;
        private int nameIndex;
        private int descriptorIndex;
        private int index;

        public int getStartPc() {
            return startPc;
        }

        public void setStartPc(int startPc) {
            this.startPc = startPc;
        }

        public int getLength() {
            return length;
        }

        public void setLength(int length) {
            this.length = length;
        }

        public int getNameIndex() {
            return nameIndex;
        }

        public void setNameIndex(int nameIndex) {
            this.nameIndex = nameIndex;
        }

        public int getDescriptorIndex() {
            return descriptorIndex;
        }

        public void setDescriptorIndex(int descriptorIndex) {
            this.descriptorIndex = descriptorIndex;
        }

        public int getIndex() {
            return index;
        }

        public void setIndex(int index) {
            this.index = index;
        }
    }
}
